package com.jkc.xh.models;

import android.text.TextUtils;

import java.io.Serializable;

/**
 * Created by zhangbreeze on 15/11/17.
 */
public class HoldOneModel implements Serializable {
    public String id;
    public String lid;
    public String stock_code;
    public String stock_name;
    public String own_amount;
    public String enable_amount;
    public String freeze_sell_amount;
    public String cost_price;
    public String last_price;
    public String market_value;
    public String profit_money;
    public String profit_rate;
    public String stop_price;
    public String in_time;
    public String sum_dpt_money;
    public int halt_flag;
    public int sell_flag;
    public int auto_deposit;
    public int auto_delay;
    public int auto_deposit_disabled;
    public int auto_delay_disabled;
    public String add_dpt_money;
    public String add_fee_money;
    public int haltdpt_show;
    public int haltdpt_flag;
    public int haltdpt_disabled;

    /**
     * 是否盈利
     *
     * @return
     */
    public boolean isProfit() {
        boolean result = false;
        if (!TextUtils.isEmpty(profit_money) && !profit_money.startsWith("-")) {
            result = true;
        }
        return result;
    }

    /**
     * 股票是否可买
     *
     * @return true 可卖
     */
    public boolean isStockCanSell() {
        if (sell_flag == 1) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 停牌  true 已经停牌
     *
     * @return
     */
    public boolean isStop() {
        if (halt_flag == 1) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 是否显示补交保证金信息框  true 已经停牌
     *
     * @return
     */
    public boolean isShowHaltdpt() {
        if (haltdpt_show == 1) {
            return true;
        } else {
            return false;
        }

    }

    /**
     * 是否完成保证金缴纳
     *
     * @return true 完成
     */
    public boolean isDoHaltdpt() {
        if (haltdpt_flag == 1) {
            return true;
        } else {
            return false;
        }
    }

    /*
                "id" : "持仓ID",
                "lid" : "LID",
                "stock_code" : "证券代码",
                "stock_name" : "名称",
                "own_amount" : "证券数量",
                "enable_amount" : "可用数量",
                "freeze_sell_amount" : "今卖数量",
                "cost_price" : "持仓成本",
                "last_price" : "当前价格",
                "market_value" : "当前市值",
                "profit_money" : "持仓盈亏",
                "profit_rate" : "盈亏比例",
                "stop_price" : "止损价格",
                "in_time" : "买入时间",
                "sum_dpt_money" : "己付保证金",
                "halt_flag" : "是否停牌，1=停牌",
                "sell_flag" : "是否可卖，1=可卖，2=不可",
                "auto_deposit" : "自动补交保证金，1=是，0=否",
                "auto_delay" : "自动延期，1=可卖，1=是，0=否",
                "auto_deposit_disabled" : "自动补交保证金框是否禁用，1=禁用，0=可用",
                "auto_delay_disabled" : "自动延期框是否禁用，1=禁用，0=可用",
                "add_dpt_money" : "延期补交保证金",
                "add_fee_money" : "延期资金占用费"
                "haltdpt_show" : "补交保证金降息框是否显示，1=是，0=否",
                "haltdpt_flag" : "补交保证金降息框勾选状态，1=是，0=否",
                "haltdpt_disabled" : "补交保证金降息框是否禁用，1=禁用，0=可用"
    *
    * */
}
